<template>
  <div class="data-box">
    <div class="data-title">{{ info.platformData }}</div>
    <div class="data-main">
      <div class="data-item">
        <div class="data-num">{{ product }}</div>
        <div class="data-name">{{ info.productData }}</div>
      </div>
      <div class="data-item">
        <div class="data-num">{{ table }}</div>
        <div class="data-name">{{ info.resourceData }}</div>
      </div>
      <div class="data-item">
        <div class="data-num">{{ menu }}</div>
        <div class="data-name">{{ info.menuData }}</div>
      </div>
      <div class="data-item">
        <div class="data-num">{{ func }}</div>
        <div class="data-name">{{ info.funcData }}</div>
      </div>
      <div class="data-item">
        <div class="data-num">{{ dictionary }}</div>
        <div class="data-name">{{ info.dictionData }}</div>
      </div>
      <div class="data-item">
        <div class="data-num">{{ workflow }}</div>
        <div class="data-name">{{ info.workflowData }}</div>
      </div>
    </div>
  </div>
</template>

<script>
  import { defineComponent, ref, toRefs, onBeforeMount, onMounted, nextTick } from 'vue';
  import { useI18n } from '@common/locales';
  import { GetPlatformData } from '@/api';
  export default defineComponent({
    name: 'DevelopData',
    setup() {
      const t = useI18n().t;
      let product = ref(0); //产品
      let table = ref(0); //资源表
      let menu = ref(0); //菜单
      let func = ref(0); //功能
      let dictionary = ref(0); //字典
      let workflow = ref(0); //工作流
      const state = {
        info: {
          platformData: t('developBoard.platformData'),
          productData: t('developBoard.productData'),
          resourceData: t('developBoard.resourceData'),
          menuData: t('developBoard.menuData'),
          funcData: t('developBoard.funcData'),
          dictionData: t('developBoard.dictionData'),
          workflowData: t('developBoard.workflowData'),
        },
      };
      const methods = {
        initPlatformData() {
          GetPlatformData().then((res) => {
            if (res.code == 1000 && res.success) {
              let resData = res.data;
              product.value = resData.product;
              table.value = resData.table;
              menu.value = resData.menu;
              func.value = resData.func;
              dictionary.value = resData.dictionary;
              workflow.value = resData.workflow;
            }
          });
        },
      };
      onBeforeMount(() => {
        methods.initPlatformData();
      });
      onMounted(() => {});
      return {
        product, //产品
        table, //资源表
        menu, //菜单
        func, //功能
        dictionary, //字典
        workflow, //工作流
        ...toRefs(state),
      };
    },
  });
</script>
<style scoped lang="less">
  .data-box {
    width: 100%;
    height: 124px;
    margin-top: 20px;
    border-radius: 4px;
    background-color: #ffffff;
    box-sizing: border-box;
    padding: 0 20px 20px;
    .data-title {
      width: 100%;
      height: 60px;
      line-height: 60px;
      font-size: 16px;
      font-weight: bold;
      color: #3f3f3f;
    }
    .data-main {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 10px;
      .data-item {
        width: 15%;
        .data-num {
          width: 100%;
          height: 20px;
          line-height: 20px;
          font-size: 24px;
          font-weight: 400;
          color: #a9aba9;
          text-align: center;
        }
        .data-name {
          width: 100%;
          height: 20px;
          line-height: 20px;
          font-size: 14px;
          color: #3f3f3f;
          text-align: center;
          margin-top: 4px;
        }
      }
    }
  }
</style>
